package com.shiguiwu.springmybatis.designpattern.flyweight;

import java.util.HashMap;
import java.util.Map;

/**
 * @description: 工厂类
 * @author: stone
 * @date: Created by 2021/3/3 21:34
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.designpattern.flyweight
 */
public class EmployeeFactory {
    private static final Map<String, Employee> EMPLOYEE_MAP = new HashMap<>();

    public static Employee getManager(String department) {
        return EMPLOYEE_MAP.computeIfAbsent(department, Manager::new);
    }
}
